<%@ page import="java.io.File" %>
<%@ page import="java.net.URLEncoder" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/8/21
  Time: 13:49
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<%
    String workerNo=(String) session.getAttribute("workerNo");
    String courseNo=(String) session.getAttribute("courseNo");
    request.setCharacterEncoding("UTF-8");
    response.setContentType("text/html;charset=UTF-8");
    out.println(workerNo);
%>
<head>
    <title>单元学习</title>
    <link href="/SystemerNav/SystemerNav.css" rel="stylesheet" type="text/css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    <link rel="stylesheet" href="https://unpkg.com/purecss@0.6.1/build/pure-min.css" integrity="sha384-CCTZv2q9I9m3UOxRLaJneXrrqKwUNOzZ6NGEUMwHtShDJ+nCoiXJCAgi05KfkLGY" crossorigin="anonymous">
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</head>
<body background="/LoginInterface/loginFace.jpg">
<div class="container">
    <div class="top">
        <div id="navbar" class="collapse navbar-collapse">
            <ul class="nav navbar-nav">
                <li><a href="courseMangement.jsp?workerNo=<%=workerNo%>&courseNo=<%=courseNo%>">首页</a> </li>
                <li><a href="/TeacherServlet/seletIntroduceServlet?workerNo=<%=workerNo%>&courseNo=<%=courseNo%>">课程简介</a> </li>
                <li><a href="AddStudentLesson.jsp">添加学生</a> </li>
                <li><a href="unitStudy.jsp?workerNo=<%=workerNo%>&courseNo=<%=courseNo%>">单元学习</a></li>
                <li><a href="courseWorkMangement.jsp?workerNo=<%=workerNo%>&courseNo=<%=courseNo%>">作业管理</a> </li>
                <li><a href="SolvePro.jsp?workerNo=<%=workerNo%>&courseNo=<%=courseNo%>">答疑讨论</a> </li>
            </ul>
        </div>

            <table class="pure-table pure-table-horizontal">
                <thead>
                <tr>
                    <th>单元学习</th>
                    <th>查看</th>
                </tr>
                </thead>
                <tbody>
                <%
                    /*response.setCharacterEncoding("GBK");
                    request.setCharacterEncoding("GBK");*/
                    try {
                        File fDir=new File("F:\\JWGLXT\\web\\StoreResoures\\"+workerNo+"\\"+courseNo);
                        //若指定目录不存在则创建该目录
                        if(!fDir.exists()){
                            fDir.mkdirs();
                        }
                        String filePath="F:\\JWGLXT\\web\\StoreResoures\\"+workerNo+"\\"+courseNo;

                        //若指定目录存在
                        if(fDir.isDirectory() && fDir.exists()){
                            //取出目录下的文件
                            String [] f_array=fDir.list();
                            //遍历并打印出文件
                            for(int i=0;i<f_array.length;i++)
                            {
                %>
                    <tr>
                        <td><%=f_array[i]%></td>

                        <td>
                            <form action="konwLedgePoint.jsp">
                                <input type="hidden" name="courseNo" value="<%=courseNo%>">
                                <input type="hidden" name="workerNo" value="<%=workerNo%>">
                                <input type="hidden" name="dirName" value="<%=f_array[i]%>">
                                <input type="hidden" name="filePath" value="<%=filePath%>">
                                <button type="submit" class="btn btn-success">管理知识点</button>
                            </form>
                        </td>
                    </tr>

                <%
                            }
                        }
                    }catch (Exception e){
                        e.printStackTrace();
                    }
                %>
                </tbody>
            </table>

        <form class="pure-form" action="/TeachLesson/addStudyUnitServlet" method="post">
            <fieldset>
                <legend>添加学习单元</legend>
                <input type="hidden" name="courseNo" value="<%=courseNo%>">
                <input type="hidden" name="workerNo" value="<%=workerNo%>">
                <input type="text" placeholder="学习单元名" name="dirName">
                <button type="submit" class="pure-button pure-button-primary">添加学习单元</button>
            </fieldset>
        </form>
    </div>
</div>

        </div>

    </div>
</div>
</body>
</html>
